// 资源贫瘠得阈值，低于这个值就是贫瘠
export const ShortResource:Record<string,number>=
{
    // 资源原矿

    [RESOURCE_UTRIUM]:10000,
    [RESOURCE_LEMERGIUM]:10000,
    [RESOURCE_KEANIUM]:10000,
    [RESOURCE_ZYNTHIUM]:10000,
    [RESOURCE_OXYGEN]:10000,
    [RESOURCE_HYDROGEN]:10000,
    [RESOURCE_CATALYST]:10000,
    [RESOURCE_GHODIUM]:2000,

}
export const SurplusResource:Record<string,number>=
{
    // 资源原矿
    [RESOURCE_ENERGY]:200000,
    [RESOURCE_UTRIUM]:50000,
    [RESOURCE_LEMERGIUM]:50000,
    [RESOURCE_KEANIUM]:50000,
    [RESOURCE_ZYNTHIUM]:50000,
    [RESOURCE_OXYGEN]:50000,
    [RESOURCE_HYDROGEN]:50000,
    [RESOURCE_CATALYST]:50000,

    // 压缩矿
    [RESOURCE_OXIDANT]:10000,
    [RESOURCE_REDUCTANT]:10000,
    [RESOURCE_UTRIUM_BAR]:10000,
    [RESOURCE_LEMERGIUM_BAR]:10000,
    [RESOURCE_KEANIUM_BAR]:10000,
    [RESOURCE_ZYNTHIUM_BAR]:10000,
    [RESOURCE_PURIFIER]:10000,

    [RESOURCE_GHODIUM]:3000,
    // 商品资源
    [RESOURCE_MIST]:1000,
    [RESOURCE_BIOMASS]:1000,
    [RESOURCE_METAL]:1000,
    [RESOURCE_SILICON]:1000,

    // OPS
    [RESOURCE_OPS]:10000,
    [RESOURCE_POWER]:50000
}

// 这个基础的原材料1-5级都有可能会需要
export const depo_resoource:Record<string,number>=
{
    [RESOURCE_WIRE]:1000,
    [RESOURCE_CELL]:1000,
    [RESOURCE_ALLOY]:1000,
    [RESOURCE_CONDENSATE]:1000,
}
export const terminal_config={
    space:50000,
    energy_require:100000,
}

export const base_depo:Record<string,Set<CommodityConstant>>={

    1:new Set<CommodityConstant>([RESOURCE_CELL,RESOURCE_ALLOY,RESOURCE_WIRE,RESOURCE_CONDENSATE]),
    2:new Set<CommodityConstant>([RESOURCE_CELL,RESOURCE_ALLOY,RESOURCE_WIRE,RESOURCE_CONDENSATE]),
    3:new Set<CommodityConstant>([RESOURCE_WIRE,RESOURCE_CONDENSATE]),
    4:new Set<CommodityConstant>([RESOURCE_CONDENSATE]),
    5:new Set<CommodityConstant>([RESOURCE_CELL,]),
}

export let depo_level_resource: Record<number,CommodityConstant[]>;

export function getDepoLevelResource(): Record<number,CommodityConstant[]>
{
    if(depo_level_resource)
    {
        return depo_level_resource
    }
    depo_level_resource={}
    for(let key in COMMODITIES)
    {
        const item =COMMODITIES[key as CommodityConstant];
        if(item.level)
        {
            if(!depo_level_resource[item.level])
            {
                depo_level_resource[item.level]=[key as CommodityConstant];
            }
            else
            {
                depo_level_resource[item.level].push(key as CommodityConstant)
            }
        }
    }
    return depo_level_resource;
}

export function isNeedBaseResource(level:number,resourceType:CommodityConstant)
{
    if(base_depo[level] && base_depo[level].has(resourceType))
    {
        return true;
    }
    return false;
}
export interface IZipNum
{
    Commodity:CommodityConstant,
    Zip:number,
    UZip:number,
}
/**压缩资源每次压缩多少*/
export const ZipResource:Record<string,IZipNum>=
{
    // 资源原矿
    [RESOURCE_ENERGY]:{Zip:12000,UZip:1000,Commodity:RESOURCE_BATTERY},
    [RESOURCE_UTRIUM]:{Zip:10000,UZip:400,Commodity:RESOURCE_UTRIUM_BAR},
    [RESOURCE_LEMERGIUM]:{Zip:12000,UZip:400,Commodity:RESOURCE_LEMERGIUM_BAR},
    [RESOURCE_KEANIUM]:{Zip:12000,UZip:400,Commodity:RESOURCE_KEANIUM_BAR},
    [RESOURCE_ZYNTHIUM]:{Zip:12000,UZip:400,Commodity:RESOURCE_ZYNTHIUM_BAR},
    [RESOURCE_OXYGEN]:{Zip:12000,UZip:400,Commodity:RESOURCE_OXIDANT},
    [RESOURCE_HYDROGEN]:{Zip:12000,UZip:400,Commodity:RESOURCE_REDUCTANT},
    [RESOURCE_CATALYST]:{Zip:12000,UZip:400,Commodity:RESOURCE_PURIFIER},

}